package org.wheel.plugins.toolkit.sql.render;

import cn.hutool.core.util.ReUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
import org.wheel.plugins.toolkit.sql.core.AbstractParamRender;

import java.util.LinkedHashMap;

public class Custom0 extends AbstractParamRender {

    // 直接使用 LogFactory 创建日志对象，Hutool 会自动检测项目中的日志框架（优先级：Slf4j > Log4j > Logback > JDK Logging）
    private static final Log log = LogFactory.get();

    public Custom0(LinkedHashMap<String, Object> paramMap) {
        super(paramMap);
    }

    @Override
    public String render(String sql) {
        return ReUtil.replaceAll(sql, ":(\\w+)", m -> {
            String key = m.group(1);
            return StrUtil.format("\\{{}\\}", key) ;
        });
    }
}
